package oop.ex1.orders;

import java.io.File;
import java.util.Comparator;
//###############
//FILE : NameFilter.java
//WRITER : Amir Wilf, wilfoa, 300007085
//WRITER : Daniel Acherkan, danithelion, 310116348
//EXERCISE : oop ex1 2011
//DESCRIPTION:
//A class to compare files by their Byte size
//###############
public class SizeOrder implements Comparator<File>{

	@Override
	public int compare(File file1, File file2) {
		if(file1.length() < file2.length() ){
			return -1;
		}
		else{
			if(file1.length() > file2.length()){
				return 1;
			}
			//in case of equality, order by absolute path
			else{
				return file1.compareTo(file2);
			}
		}
	}
}
